package com.example.ssm.dao;

import com.example.ssm.entity.Merchant;
import com.example.ssm.entity.UpComing_Shop;
import com.example.ssm.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.servlet.annotation.WebServlet;
import java.sql.SQLException;
import java.util.List;

public interface ShopDao {
//商家提交审批
    @Insert("insert into onlinesys.upcoming_shop(shop_name, user_name, pwd, legal_p, tel) VALUES (#{shop_name},#{user_name},#{pwd},#{legal_p},#{tel})")
    public void ToSubmit(UpComing_Shop shop);

    //show All审批
    @Select("select *from onlinesys.upcoming_shop")
    public List<UpComing_Shop> selectAllShop();

    //show By shop_name
@Select("select *from onlinesys.upcoming_shop where shop_name=#{shop_name}")
    public UpComing_Shop selectByName(UpComing_Shop shop);

    //管理员同意审批
    @Insert("insert into onlinesys.merchant(shop_name, user_name, pwd, legal_p, tel, account) VALUES (#{shop_name},#{user_name},#{pwd},#{legal_p},#{tel},0)")
    public void insert(UpComing_Shop shop);
    //驳回审批
    @Delete("delete from onlinesys.upcoming_shop where shop_name=#{shop_name}")
    public void del(String shop_name);

    //selectShopNameByUserName
    @Select("select *from onlinesys.merchant where user_name=#{user_name}")
    Merchant select(String use_name);

    @Select("select *from onlinesys.merchant where shop_name=#{shop_name}")
    Merchant selectByShopName(Merchant merchant);

    @Update("update onlinesys.merchant set account=#{account}  where user_name=#{user_name}")
    boolean addMoney(Merchant merchant);
}
